CC = @CC@
INCLUDES = -I./ncmlib
objects = util.o checkip.o $(PLATFORM).o dns_helpers.o dns_dyn.o dns_nc.o dns_he.o cfg.o ndyndns.o
CURLINC = @CURLINC@
CURLLIB = @CURLLIB@
VERSION = @VERSION@
CFLAGS = @CFLAGS@ -std=gnu99 -Wall -Wextra -Wno-format-extra-args -Wno-format-zero-length -Wformat-nonliteral -Wformat-security -pedantic $(CURLINC) $(INCLUDES)
PLATFORM = @PLATFORM@
prefix = @prefix@
exec_prefix = @exec_prefix@
sbindir = @sbindir@
datarootdir = @datarootdir@
mandir = @mandir@

NCMSRC = ncmlib/log.c ncmlib/strl.c ncmlib/malloc.c ncmlib/chroot.c ncmlib/pidfile.c ncmlib/signals.c ncmlib/strlist.c
NCMOBJ = $(NCMSRC:.c=.o)

all: ndyndns

ndyndns : $(objects) ncmlib
	$(CC) -o ndyndns $(objects) $(LDFLAGS) -L. -lncm $(CURLLIB)

ndyndns.o : util.h checkip.h $(PLATFORM).h cfg.h
	$(CC) $(CFLAGS) -c -o $@ ndyndns.c

ncmlib : $(NCMOBJ)
	ar rcs libncm.a $(NCMOBJ)

install: ndyndns
	-install -s -m 755 ndyndns $(sbindir)/ndyndns
	-install -m 644 ndyndns.1.gz $(mandir)/man1/ndyndns.1.gz
	-install -m 644 ndyndns.conf.5.gz $(mandir)/man5/ndyndns.conf.5.gz
tags:
	-ctags -f tags *.[ch]
	-cscope -b
clean:
	-rm -f *.o ncmlib/*.o ndyndns libncm.a
distclean:
	-rm -f *.o ncmlib/*.o ndyndns libncm.a tags cscope.out config.h config.log config.status Makefile
	-rm -Rf autom4te.cache

